Skip to content

introduce SMV enumeration type #1154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 26, 2025
Merged

introduce SMV enumeration type #1154

merged 1 commit into from
Jul 26, 2025

Conversation

kroening
Copy link
Member

@kroening kroening commented Jun 12, 2025

SMV enumerations behave differently from enumeration_typet; hence, this introduces smv_enumeration_typet, which is subsequently lowered to enumeration_typet.

@kroening kroening added the SMV label Jun 12, 2025
@kroening kroening force-pushed the smv-enumeration-type branch 4 times, most recently from f3f9ae8 to 2fc9d2b Compare June 12, 2025 22:32
@kroening kroening force-pushed the smv-enumeration-type branch from 2fc9d2b to b2da631 Compare June 30, 2025 10:38
@kroening kroening force-pushed the smv-enumeration-type branch 2 times, most recently from 28a3c20 to 554935c Compare July 23, 2025 02:37
@kroening kroening marked this pull request as ready for review July 23, 2025 02:40
for(auto &element1 : elements())
{
bool found = false;
for(auto &element2 : other.elements())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the realistic size of enums the quadratic algorithm might not matter too much, but repeatedly invoking other.elements() seems avoidable. This should be other.find(ID_elements).get_sub() instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now replaced by a set, which makes this n log n.

@kroening kroening force-pushed the smv-enumeration-type branch from 554935c to 2fb77f9 Compare July 24, 2025 14:14
for(auto &element : other_elements_sub)
other_elements.insert(element.id());

for(auto &element : elements())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for removing the quadratic approach. But I don't think we should use elements() here either as for(auto &e : find(ID_elements).get_sub()) would avoid constructing the vector.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@kroening kroening force-pushed the smv-enumeration-type branch 3 times, most recently from 3ba9b05 to 203f9d0 Compare July 26, 2025 11:09
SMV enumerations behave differently from enumeration_typet; hence, this
introduces smv_enumeration_typet, which is subsequently lowered to
enumeration_typet.
@kroening kroening force-pushed the smv-enumeration-type branch from 203f9d0 to caeaab7 Compare July 26, 2025 11:19
@kroening kroening merged commit a152b63 into main Jul 26, 2025
10 checks passed
@kroening kroening deleted the smv-enumeration-type branch July 26, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants